import request from '@/utils/request'

/**
 * 获取用户频道，可以不登录
 * @returns Promise
 */
export const getChannelList = () => {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}

/**
 * 获取所有的频道
 */
export const getAllChannelList = () => {
  return request({
    method: 'get',
    url: '/v1_0/channels'
  })
}

/**
 * 添加频道
 * @param {*} channels
 * @returns
 */
export function addChannel(channels) {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}

/**
 * 删除频道
 * @param {'*'} id
 * @returns
 */
export function delChannel(id) {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${id}`
  })
}
